package com.cyt.web.controller.work.kwmanagement;

import com.cyt.base.enums.BusinessType;
import com.cyt.base.enums.OperatorType;
import com.cyt.base.model.dto.ReturnResult;
import com.cyt.base.util.StringUtils;
import com.cyt.work.kwmanagement.model.vo.KwStudentSignVo;
import com.cyt.work.kwmanagement.service.KwStudentSignService;
import com.cyt.sys.aspect.BaseLog;
import com.cyt.web.controller.base.BaseController;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 学生签到表-学生签到表控制层
 *
 * @author Han Jun
 * @date 2019-12-11 15:33:50
 */
@RestController
public class KwStudentSignController extends BaseController {

    @Resource
    private KwStudentSignService kwStudentSignService;
    
    /**
     * 统一跳转
     *
     * @param model 数据模型
     * @return Model
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @RequestMapping("/work/kwmanagement/kwstudentsign/*")
    public Model goPage(Model model) {
        return model;
    }

    /**
     * 分页查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @param page 分页数
     * @param limit 每页显示条数
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "分页查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findPage", method = RequestMethod.POST)
    public ReturnResult findPage(KwStudentSignVo kwStudentSignVo, int page, int limit) {
        return kwStudentSignService.findPage(kwStudentSignVo, page, limit);
    }

    /**
     * 分页查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @param page 分页数
     * @param limit 每页显示条数
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "分页查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findVoPage", method = RequestMethod.POST)
    public ReturnResult findVoPage(KwStudentSignVo kwStudentSignVo, int page, int limit) {
        return kwStudentSignService.findVoPage(kwStudentSignVo, page, limit);
    }

    /**
     * list查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "list查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findList", method = RequestMethod.POST)
    public ReturnResult findList(KwStudentSignVo kwStudentSignVo) {
        return new ReturnResult(kwStudentSignService.findList(kwStudentSignVo));
    }

    /**
     * list查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "list查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findVoList", method = RequestMethod.POST)
    public ReturnResult findVoList(KwStudentSignVo kwStudentSignVo) {
        return new ReturnResult(kwStudentSignService.findVoList(kwStudentSignVo));
    }

    /**
     * 单个对象查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "one查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findOne", method = RequestMethod.POST)
    public ReturnResult findOne(KwStudentSignVo kwStudentSignVo) {
        return new ReturnResult(kwStudentSignService.findOne(kwStudentSignVo));
    }

    /**
     * 单个对象查询
     *
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "one查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/findVoOne", method = RequestMethod.POST)
    public ReturnResult findVoOne(KwStudentSignVo kwStudentSignVo) {
        return new ReturnResult(kwStudentSignService.findVoOne(kwStudentSignVo));
    }

    /**
     * 跳转添加或编辑界面
     *
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "跳转添加或编辑界面", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/getEdit", method = RequestMethod.GET)
    public ModelAndView getEdit(KwStudentSignVo kwStudentSignVo) {
        ModelAndView view = new ModelAndView("/work/kwmanagement/kwstudentsign/kwStudentSignEdit");
        if (StringUtils.isNotBlank(kwStudentSignVo.getId())) {
            view.addObject(kwStudentSignService.findVoOne(kwStudentSignVo));
        }
        return view;
    }


    /**
     * 根据条件逻辑删除
     *
     * @param request 请求对象
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "逻辑删除对象", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/remove", method = RequestMethod.GET)
    public ReturnResult remove(HttpServletRequest request, KwStudentSignVo kwStudentSignVo) {
        return kwStudentSignService.remove(kwStudentSignVo, acceptCurrentUser(request));
    }

    /**
     * 根据条件物理删除
     *
     * @param request 请求对象
     * @param kwStudentSignVo 接受参数对象
     * @return ReturnResult
     * @author Han Jun
     * @date 2019-12-11 15:33:50
     */
    @BaseLog(module = "学生签到表", classz = "学生签到表", methods = "物理对象对象", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/kwmanagement/kwstudentsign/delete", method = RequestMethod.GET)
    public ReturnResult delete(HttpServletRequest request, KwStudentSignVo kwStudentSignVo) {
        return kwStudentSignService.delete(kwStudentSignVo, acceptCurrentUser(request));
    }



}